// # 状态标签组件

import React from 'react';

const StatusBadge = ({ status }) => {
    // 根据状态获取标签样式
    const getStatusClass = (status) => {
        switch (status) {
            case 'approved':
                return 'bg-green-100 text-green-800';
            case 'pending':
                return 'bg-yellow-100 text-yellow-800';
            case 'rejected':
                return 'bg-red-100 text-red-800';
            default:
                return 'bg-gray-100 text-gray-800';
        }
    };

    // 根据状态获取图标字符
    const getStatusIcon = (status) => {
        switch (status) {
            case 'approved':
                return '✅';
            case 'pending':
                return '🕒';
            case 'rejected':
                return '❌';
            default:
                return '•';
        }
    };

    // 根据状态获取文本
    const getStatusText = (status) => {
        switch (status) {
            case 'approved':
                return '已通过';
            case 'pending':
                return '待审核';
            case 'rejected':
                return '已拒绝';
            default:
                return status;
        }
    };

    return (
        <span className={`inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${getStatusClass(status)}`}>
            {getStatusIcon(status)}
            <span className="ml-1">{getStatusText(status)}</span>
        </span>
    );
};

export default StatusBadge;  